package com.bqtv.sport.ui.main.fragment

import android.os.Bundle
import android.view.View
import androidx.viewbinding.ViewBinding
import com.bqtv.sport.app.AppActivity
import com.bqtv.sport.app.AppFragment
import com.bqtv.sport.databinding.FragmentEmptyBinding
import com.bqtv.sport.databinding.FragmentMineBinding
import com.bqtv.sport.ui.mine.ActivityCenterActivity
import com.bqtv.sport.ui.mine.AnchorRelatedActivity
import com.bqtv.sport.ui.mine.BecomeStreamerActivity
import com.bqtv.sport.ui.mine.InviteFriendsActivity
import com.bqtv.sport.ui.mine.MyBaDouActivity
import com.bqtv.sport.ui.mine.MyVipActivity
import com.bqtv.sport.ui.mine.PersonalProfileActivity
import com.bqtv.sport.ui.mine.PointsMallActivity
import com.bqtv.sport.ui.mine.QRCodeScanActivity
import com.bqtv.sport.ui.mine.SettingActivity
import com.bqtv.sport.ui.mine.WatchHistoryActivity


class MineFragment : AppFragment<FragmentMineBinding, AppActivity<ViewBinding>>() {

    companion object {
        private const val INTENT_KEY_TYPE = "type"
        fun newInstance(): MineFragment {
            val fragment = MineFragment()
            val bundle = Bundle()
            fragment.arguments = bundle
            return fragment
        }

        fun newInstance(type: String?): MineFragment {
            val fragment = MineFragment()
            val bundle = Bundle()
            bundle.putString(INTENT_KEY_TYPE, type)
            fragment.arguments = bundle
            return fragment
        }
    }

    override fun getViewBinding() = FragmentMineBinding.inflate(layoutInflater)

    override fun initView() {

    }

    override fun initData() {

        initListener()
    }
    private fun initListener() {
        binding.ivHead.setOnClickListener(this)
        binding.tvNickname.setOnClickListener(this)
        binding.tvSignature.setOnClickListener(this)
        binding.tdSign.setOnClickListener(this)
        binding.tdEdit.setOnClickListener(this)
        binding.tdPointsMall.setOnClickListener(this)
        binding.tdWatchHistory.setOnClickListener(this)
        binding.tdAnchorRelated.setOnClickListener(this)
        binding.tdActivityCenter.setOnClickListener(this)
        binding.tvMyBaDou.setOnClickListener(this)
        binding.llMyLevel.setOnClickListener(this)
        binding.llInviteFriends.setOnClickListener(this)
        binding.llAboutUs.setOnClickListener(this)
        binding.llBecomeStreamer.setOnClickListener(this)
        binding.llOnlineCustomer.setOnClickListener(this)
        binding.llSetting.setOnClickListener(this)
        binding.tvWithdraw.setOnClickListener(this)
    }

    override fun onClick(view: View) {
        super.onClick(view)
        when(view){
            binding.ivHead,binding.tvNickname,binding.tvSignature -> {
                PersonalProfileActivity.start(getAttachActivity()!!)
            }
            binding.tdSign -> {
                PointsMallActivity.start(getAttachActivity()!!)
            }
            binding.tdEdit -> {
                PersonalProfileActivity.start(getAttachActivity()!!)
            }
            binding.tdPointsMall -> {
                PointsMallActivity.start(getAttachActivity()!!)
            }
            binding.tdWatchHistory -> {
                WatchHistoryActivity.start(getAttachActivity()!!)
            }
            binding.tdAnchorRelated -> {
                AnchorRelatedActivity.start(getAttachActivity()!!)
            }
            binding.tdActivityCenter -> {
                ActivityCenterActivity.start(getAttachActivity()!!)
            }
            binding.tvWithdraw -> {
                MyBaDouActivity.start(getAttachActivity()!!)
            }
            binding.tvMyBaDou -> {
                MyBaDouActivity.start(getAttachActivity()!!)
            }
            binding.llMyLevel -> {
                MyVipActivity.start(getAttachActivity()!!)
            }
            binding.llInviteFriends -> {
                InviteFriendsActivity.start(getAttachActivity()!!)
            }
            binding.llAboutUs -> {

            }
            binding.llBecomeStreamer -> {
                BecomeStreamerActivity.start(getAttachActivity()!!)
            }
            binding.llOnlineCustomer -> {

            }
            binding.llSetting -> {
                SettingActivity.start(getAttachActivity()!!)
            }
        }
    }
}

